<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
			<button onclick="foo1()">打开窗口</button>
				<button onclick="foo2()">关闭窗口</button>
				
				<script>
					
					var w;
					function foo1()
					{
						w = window.open("new.html","new","width=200,height=100")
						// 移动到屏幕中央
						var w2 = screen.width;
						var h2 = screen.height;
						w.moveTo((w2-200)/2,(h2-100)/2)
					}
			
					function foo2()
					{
						// close() 关闭自己这个窗口
						w.close()
					}
				</script>
	</body>
</html>